<template>
  <div class="wheel" ref="wheel">
    <van-swipe :autoplay="3000" show-indicators="true">
      <van-swipe-item
        class="item"
        style="height: px2rem(400px);"
        v-for="(item, index) in wheelList"
        :key="index"
      >
        <img :src="item.image|image">
        <span class="title">{{item.title}}</span>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
export default {
  name: "wheel",
  mounted() {
    this.$store.dispatch("updateWheelList");
  },
  computed: {
    wheelList() {
      return this.$store.state.wheelList;
    }
  }
};
</script>

<style lang="scss" scope>
@import "../assets/style/common.scss";

.wheel {
  margin-top: px2rem(100px);
  width: inherit;
  height: px2rem(400px);
  overflow-x: hidden;
  position: relative;

  .item {
    position: relative;
    float: left;
    height: px2rem(400px);
    background-color: transparent;
    overflow: hidden;

    img {
      width: 100%;
      height: auto;
    }

    .title {
      width: inherit;
      position: absolute;
      height: px2rem(152px);
      bottom: 0;
      left: 0;
      @include font-dpr(20px);
      display: inline-block;
      background-color: rgba(0, 0, 0, 0.2);
      color: #fff;
      padding: px2rem(20px) px2rem(42px) 0;
    }
  }
}
</style>